/*
 * @Author: Qimu
 * @Date: 2020-04-17 08:36:48
 * @LastEditors: Qimu
 * @LastEditTime: 2020-05-24 16:32:31
 * @Description: file content
 * @FilePath: \vue-admin-koa2\koa2_api\module\schama\role.js
 */
const mongoose = require('../db/mongodb');
const config = require('../config/config');

const roleSchema = mongoose.Schema({
  role_name: { //角色名称
    type: String,
    required: true,
    trim: true
  },
  role_sketch: { //角色简述
    type: String,
    required: true,
    trim: true
  },
  role_status: { //角色状态
    type: Number,
    default: 1
  },
  role_createTime: { //角色创建时间
    type: Date,
    default: Date.now,
  },
  role_updateTime: { //角色更新时间
    type: Date,
    default: Date.now,
  },
}, {
  timestamps: {
    createdAt: 'role_createTime',
    updatedAt: 'role_updateTime'
  }
})

module.exports = Role = mongoose.model('Role', roleSchema, `${config.mongodb.table}role`);